This is our attempt at it:
declare @SPId varchar(1000)
Print '[SQLTRIX] Killing active connections'
Print ''
SELECT @SPId = COALESCE(@SPId,'')+'KILL '+CAST(SPID AS VARCHAR)+'; '
FROM Master..SysProcesses WHERE DB_NAME(DBId) = '?DB_NAME?'--@DBNAME
and spid >= 50 and SPId <> @@spid
PRINT @SPId
EXEC(@SPId)
Print ''
GO
I find we can't start the restore fast enough about 1/4 of the time.
412-977-3526 call/text