I\'m trying to figure out how I can check if a database role exists in SQL Server. I want to do something like this:
if not exists (select 1 from sometable
if not exists (select 1 from sys.database_principals where name='role' and Type = 'R') begin CREATE ROLE role AUTHORIZATION MyUser; end