sql server rename database
snippet in sql

sql server rename database

user2299

ALTER DATABASE MyTestDatabase MODIFY NAME = MyTestDatabaseCopy ;

alter database name script

user7479

USE master;  
GO  
ALTER DATABASE MyTestDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE MyTestDatabase MODIFY NAME = MyTestDatabaseCopy ;
GO  
ALTER DATABASE MyTestDatabaseCopy SET MULTI_USER
GO