Removing objects in SQL Server can be straightforward, but it often requires you to know the specific type of the object you’re working with. For example:
if object_id('obj1') is not null drop table obj1;
or
drop table if exists obj1;
While these methods work for many object types, they require you to specify the object’s type (e.g., table, procedure, etc.). However, certain object types, such as queues, lack support for an IF EXISTS clause—for instance, DROP QUEUE IF EXISTS does not exist.
Schema z introduces a stored procedure, z.usp_DropObject, designed to simplify object removal. It can drop any user-defined objects in view sys.objects.
drop table if exists obj1;
https://github.com/sqlnotes/sql/wiki/FunTricks#remove-objects