MySQL: IF statement check is a table exists
You probably want to use this syntax:

CREATE TABLE IF NOT EXISTS `table1` ( -- create table );
-- returns only a warning if the table already exists


Unless you want to check that the table name does not exist instance-wide, in which the way you "program with SQL" should be a bit different, for several reasons:

SET @check_table_name := false;

SELECT true INTO @check_table_name 
FROM information_schema.TABLES 
WHERE TABLE_NAME = 'table1'
LIMIT 1;