Dynamic select query

I have a stored procedure in mysql.

There is a select query with dynamic input in where clause

How do I capture this dynamic select query into a variable ?

you might want to show the stored proc so that we can get an idea what you’re talking about