USE [master]
GO
DECLARE @kill varchar(8000) = '';  
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), session_id) + ';'  
FROM sys.dm_exec_sessions
WHERE database_id  = db_id('arrdbdbname')

EXEC(@kill);
GO

GO
DECLARE @kill1 varchar(8000) = '';  
SELECT @kill1 = @kill1 + 'kill ' + CONVERT(varchar(5), session_id) + ';'  
FROM sys.dm_exec_sessions
WHERE database_id  = db_id('pacsdbdbname')

EXEC(@kill1);
GO

GO
DECLARE @kill2 varchar(8000) = '';  
SELECT @kill2 = @kill2 + 'kill ' + CONVERT(varchar(5), session_id) + ';'  
FROM sys.dm_exec_sessions
WHERE database_id  = db_id('pacsdbname')

EXEC(@kill2);
GO
GO

/****** Object:  Database [arrdb]    Script Date: 7/3/2019 12:00:41 PM ******/
DROP DATABASE [arrdbdbname]
GO

GO

/****** Object:  Database [pacsdb]    Script Date: 7/3/2019 12:01:04 PM ******/
DROP DATABASE [pacsdbdbname]
GO

GO

/****** Object:  Database [pacs]    Script Date: 7/3/2019 12:01:00 PM ******/
DROP DATABASE [pacsdbname]
GO

GO

/****** Object:  Login [arr]    Script Date: 7/3/2019 1:20:03 PM ******/
DROP LOGIN [user_arrdbdbname]
GO

GO

/****** Object:  Login [paacs]    Script Date: 7/3/2019 1:20:14 PM ******/
DROP LOGIN [user_pacsdbdbname]
GO

GO

/****** Object:  Login [pacs]    Script Date: 7/3/2019 1:20:21 PM ******/
DROP LOGIN [user_pacsdbname]
GO

GO