First version of select with support for stored procedures