Check if variable exists in dbt

#1

I want to implement an SQL query only if the variable exists in dbt. How to do that?