Delimiter //
CREATE Procedure SearchTest(IN FieldName varchar(30),IN FieldValue varchar(30))
BEGIN
SET @query = CONCAT('select count(*) from Some_table_name where ', FieldName,'=',FieldValue);
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END //
Delimiter ;
mysql> call SearchTest('accession_no','L138362194');
ERROR 1054 (42S22): Unknown column 'L138362194' in 'where clause'