Are there any way to execute a query inside a string value in PostgreSQL?
You pull it down to the client, and send it back to the server. That makes this a really bad idea. Even if you can dynamically generate the types of the return column in a string, which is proven here, you can't dynamically return anything with standards-compliant SQL.

If you're using psql, there is a command to automate that processes. After something returns a string of sql, you can run it with \gexec

As they say in the source above, 


  As long as you get the generated sql, you may do whatever you like with that. You may create function, view etc.


So you can do that kind of stuff too. That is, things that don't return a dynamic list of columns, like issue a CREATE FUNCTION or a CREATE SQL command.