Droping a Database by Force

The Below Procedure will drop the Database by force though it is accessing by the End Users.

-- =============================================  
-- Author:  V.U.M.Sastry Sagi
-- Create date: 12/05/2010
-- Description: Drops a Database by Force
-- =============================================  

CREATE PROCEDURE [dbo].[dropDBByForce](@DBName VARCHAR(100)) 
AS
BEGIN
	DECLARE @sql NVARCHAR(MAX)
	SET @sql='ALTER DATABASE ['+@dbname+']
SET SINGLE_USER --or RESTRICTED_USER
WITH ROLLBACK IMMEDIATE;
GO
DROP DATABASE ['+@dbname+'];
GO'
execute(@sql)
END

GO
SiteLock