USE [master]; GO ALTER DATABASE [db_name_test] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO ALTER DATABASE [db_name_test] MODIFY NAME = 'db_name_dev'; GO ALTER DATABASE [db_name_dev] SET MULTI_USER WITH ROLLBACK IMMEDIATE; GO