Print 'Doing pre run Checks to ensure script not already run'; Select * from Script_History where Script_Name='ProjectorsProdUpdate160525'; 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 product set Product_Category_ID = (select product_category_id from product_category where Master_Category_ID = 1454) where ItemMonsterId in (select ItemMonsterId from [ItemMonster].dbo.ItemMonster where Categoryid = 1454); Print 'Insert into script history if everything else is cool'; Insert into Script_History (RunDate,Script_Name) Values (CURRENT_TIMESTAMP,'ProjectorsProdUpdate160525'); IF @@ERROR != 0 BEGIN RAISERROR ('UNABLE TO CONTINUE WITH SCRIPT', 11, 1); RETURN; END GO