We make extensive use of dynamic SQL in Snowflake Stored Procedures for many reasons.
One of them being that we have several databases, each prefixed with the environment name. Like PROD_DB1, PROD_DB2, etc...
Our code is not specific to one environment so all of our stored procedures start by checking which environment they are executing in (looking at the prefix of CURRENT_DATABASE()). Then we adapt our table/view names accordingly when doing cross database stuff.
This is just one example of the various reasons for dynamic SQL.
Is there a way to do this sort of things in Snowflake SQL (as opposed to Stored procedures using javascript)?