It seems like your proposed stored procedure has a [CASE WHEN](https://community.denodo.com/docs/html/browse/6.0/vdp/vql/appendix/case_clause_examples/case_clause_examples) syntax, which Denodo VQL supports as long as you don’t need to use PL/SQL in the statement.
Based on the code of your most recent comment, it seems that you are checking the value of one variable only. If the results have the same schema in all cases of your dynamic sql, you could try create a Partitioned Union (defining that value **in_dimension_name_1** in the WHERE condition). At runtime, Denodo optimizer will use a branch pruning optimization, and only one of the branches will be executed depending on the value passed to the query. The partioned Union is documented [here](https://community.denodo.com/docs/html/browse/7.0/vdp/administration/optimizing_queries/automatic_simplification_of_queries/removing_redundant_branches_of_queries_partitioned_unions).
I hope this helps!