Hi Shayan,
Try:
IF @object_type = N'MSD_Period' AND @transaction_type = N'D'
BEGIN
IF Exists (SELECT Code
FROM [@MSD_PERIOD]
WHERE Code = @list_of_cols_val_tab_del AND U_Calculated='Y')
Begin
SET @ErrorID = 2
SET @ErrorMessage = 'Please update this Document' +@list_of_cols_val_tab_del + @transaction_type + @CALC
End
END
Thanks,
Gordon