I have a script that drops a load of tables using DROP TABLE IF EXISTS, this works.
There is also a delete in this script to DELETE a row from another table that I d
you can use bellow code:
DECLARE @TABLENAME VARCHAR(20)='TableName'; IF (OBJECT_ID(@TABLENAME) IS NOT NULL ) BEGIN execute(N'TRUNCATE TABLE ' + @TABLENAME + '' ); END ELSE BEGIN PRINT 'Table NOT Exists' END