T-SQL - sp_renamedb

On Transact SQL language the sp_renamedb is part of Database Engine Stored Procedures and changes the name of a database.
This feature will be removed in a future version of Microsoft SQL Server.
You can use the command ALTER DATABASE.

sp_renamedb syntax:

sp_renamedb [ @dbname = 'Old database name' ] , [ @newname = 'New database name' ] ;


Rename a database name:

USE master;
GO
CREATE DATABASE myTest;
GO
EXEC sp_renamedb N'myTest', N'Test';
GO

Messages
The database name 'Test' has been set.