This is a DBA script. You must have ALTER permission on the database, which is typically limited to those who are members of the db_owner database role or the sysadmin server role.
While the database is in single-user mode, you can perform tasks that require or would benefit from that restriction or just immediately switch back to multi-user.
We use this at my office when we need to refresh a database snapshot immediately. All users currently accessing the snapshot are forcibly disconnected. We then drop and recreate the snapshot.