MINUS is a SQL set operation that selects elements from the first table and then removes rows that are also returned by the second SELECT statement in Oracle. And in SQL Ser
This will check for any result set from the first query, then run the except if there is a result. If not it only runs the second query.
IF EXISTS (SELECT NULL FROM ... WHERE ...) BEGIN SELECT ... EXCEPT SELECT ... END ELSE SELECT ...