Error on renaming database in SQL Server 2008 R2
You could try setting the database to single user mode.
https://stackoverflow.com/a/11624/2408095
use masterALTER DATABASE BOSEVIKRAM SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE BOSEVIKRAM MODIFY NAME = [BOSEVIKRAM_Deleted]ALTER DATABASE BOSEVIKRAM_Deleted SET MULTI_USER
Set the database to single mode:
ALTER DATABASE dbNameSET SINGLE_USER WITH ROLLBACK IMMEDIATE
Try to rename the database:
ALTER DATABASE dbName MODIFY NAME = NewName
Set the database to Multiuser mode:
ALTER DATABASE NewNameSET MULTI_USER WITH ROLLBACK IMMEDIATE
In SQL Server Management Studio (SSMS):
You can also right click your database in the Object Explorer and go to Properties. From there, go to Options. Scroll all the way down and set Restrict Access to SINGLE_USER. Change your database name, then go back in and set it back to MULTI_USER.