As good as "ALTER DATABASE SET SINGLE_USER WITH ROLLBACK IMMEDIATE" can be, in some situations it can't be successful. You may get the below errors if there are uncommitted distributed transactions access the database. My script is designed for overcoming these...saving a trip to restart the SQL instance.
Msg 5061, Level 16, State 1, Line 1
ALTER DATABASE failed because a lock could not be placed on database 'Test'. Try again later.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
The "ALTER Database Set " command is not a guarrantee, folks. Wish everyone would never have to use my Kill script :-)