You need Dynamic SQL
DELIMITER $$
CREATE DEFINER=`root`@`localhost`
PROCEDURE `create_tb_one`(In tableName varchar(255))
BEGIN
SET @sql = CONCAT('CREATE TABLE IF NOT EXISTS ',tableName,' ');
SET @sql = CONCAT(@sql,'(ID INT NOT NULL,SNAME VARCHAR(100) NOT NULL,');
SET @sql = CONCAT(@sql,'SSTATE VARCHAR(100) NOT NULL,');
SET @sql = CONCAT(@sql,'TIME_STAMP VARCHAR(45) NOT NULL,');
SET @sql = CONCAT(@sql,'constraint FK_SENSOR ');
SET @sql = CONCAT(@sql,'foreign key (SNAME) ');
SET @sql = CONCAT(@sql,'references sensorInfo(SName) on delete set null)');
PREPARE s FROM @sql;
EXECUTE s;
DEALLOCATE PREPARE s;
END $$
DELIMITER ;
or
DELIMITER $$
CREATE DEFINER=`root`@`localhost`
PROCEDURE `create_tb_one`(In tableName varchar(255))
BEGIN
SELECT COUNT(1) INTO @table_exists
FROM information_schema.tables
WHERE table_schema=DATABASE()
AND table_name=tableName;
IF @table_exists = 0 THEN
SET @sql = CONCAT('CREATE TABLE ',tableName,' ');
SET @sql = CONCAT(@sql,'(ID INT NOT NULL,SNAME VARCHAR(100) NOT NULL,');
SET @sql = CONCAT(@sql,'SSTATE VARCHAR(100) NOT NULL,');
SET @sql = CONCAT(@sql,'TIME_STAMP VARCHAR(45) NOT NULL,');
SET @sql = CONCAT(@sql,'constraint FK_SENSOR ');
SET @sql = CONCAT(@sql,'foreign key (SNAME) ');
SET @sql = CONCAT(@sql,'references sensorInfo(SName) on delete set null)');
PREPARE s FROM @sql;
EXECUTE s;
DEALLOCATE PREPARE s;
END IF;
END $$
DELIMITER ;
Give it a Try !!!
create_tb_one('first');