I found this answer really useful, I would just like to add that, whilst not necessary, adding a "SET" command seems to remove potential errors being flagged in a Synapse notebook, magic SQL cell.
%%sql
SET myapp.myVar;
SELECT * FROM myTable WHERE myVal = '${myapp.myVar}'