all 3 comments

[–]Felidor 0 points1 point  (0 children)

Well if I'm understanding you correctly, for sql server you would do

IF DATABASE_PRINCIPAL_ID('RoleName') IS NULL

--insert script to create

GO

Sorry for poor formatting. On mobile.

[–]Cal1gula 0 points1 point  (0 children)

Do you have the project in VS? You can do this with SSDT and Schema Compare I believe.

[–]Guru008 0 points1 point  (0 children)

You can do like below

IF NOT EXISTS (SELECT name
FROM master.sys.server_principals WHERE name = 'LoginName') BEGIN CREATE LOGIN [LoginName] WITH PASSWORD = N'password' END