How would I convert this logic into a SQL statement?
IF @GrantSQL is successful, then continue to insert, if not stop query
This is the stored procedure:
BEGIN
DECLARE @GrantSql NVARCHAR(500)
SET @GrantSql = 'EXEC sp_addsrvrolemember [' + @LoginName + '], ''sysadmin'''
EXEC sp_executesql @GrantSql
-- IF @GrantSQL is successful, then continue to insert, if not stop query
BEGIN
INSERT INTO....
END
END