MYSQL - Run a query based on the results of a query
Prepared Statement is the answer for this.

set @stmt1= concat( 'select ', @var, ' from ', @vardb, ' where ', @varcond);
prepare stmt from @stmt1;
execute stmt;


For getting @tbl used properly,

   concat( 'select max(length(', @tbl, ')' ) 


will get it. But to select required columns from information_schema, you need to run a query first followed by coining this prepared statement and then execute the same.