This problem is because the database is being used or called by some processes, you can use the following sql command in the new query to view the corresponding spid, the following aa is the name of the database we are operating
use master
go
select b.spid from sysdatabases a ,sysprocesses b where a.dbid=b.dbid and a.name=’aa’