T-SQL Query to Create login from a Windows Group or Account and Assign Server Roles

How many times do we need to create a Login on SQL Server installed. In an enterprise level a DBA might be doing this task several times a day.

Below is a small script which will create a  Login from a Windows Group or Account and tricky part is you can assign the Server Level Roles to this Account on the fly.

USE [master]
GO
CREATE LOGIN [DOMAIN\USERNAME] FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO
EXEC master..sp_addsrvrolemember @loginame = N'DOMAIN\USERNAME', @rolename = N'serveradmin'
GO
EXEC master..sp_addsrvrolemember @loginame = N'DOMAIN\USERNAME', @rolename = N'sysadmin'
GO
EXEC master..sp_addsrvrolemember @loginame = N'DOMAIN\USERNAME', @rolename = N''
.
.
.
GO

You can use the sp_addsrvrolemember for any Server Role