Get the workflow's query from SQL server

Hi,

I need to get workflow query or at least query name from SQL server by a select command for AX 2012. Is that possible? It’s saved in workflow’s class but it doesn’t work for me. I need query having by a select command. Is that possible?