Hello Jens,
I'm not entirely sure what you want to do here. Do you want the IF to appear in the query, or the query to be adjusted depending on the outcome of the IF? In the second case, look into SQL-COMPILE, which allows the query s-expression to be built at run-time (rather than compile time, as with the SQL macro).
Cheers, Marijn