Print 'Doing pre run Checks to ensure script not already run'; Select * from Script_History where Script_Name='UserProfileUpdateV2'; if @@ROWCOUNT!=0 BEGIN RAISERROR('THIS SCRIPT HAS ALREADY BEEN RUN ON THIS SERVER, CANNOT CONTINUE, PLEASE CONTACT DEV',11,1); RETURN; END GO update System_User_Profile set Profile_ID = 1 where System_User_ID in (select System_User_ID from [System_User] where Global_User_ID in (189,116,105,209)) and Profile_ID = 3; Print 'Insert into script history if everything else is cool'; Insert into Script_History (RunDate,Script_Name) Values (CURRENT_TIMESTAMP,'UserProfileUpdateV2'); IF @@ERROR != 0 BEGIN RAISERROR ('UNABLE TO CONTINUE WITH SCRIPT', 11, 1); RETURN; END GO