There was some errors.
this should work.
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE oldname VARCHAR(200);
DECLARE datatype VARCHAR(200);
DECLARE cur CURSOR FOR SELECT COLUMN_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA='ADM01' AND TABLE_NAME=tblname;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN cur;
REPEAT
FETCH cur INTO oldname, datatype;
SET @newname = UPPER(oldname);
SET @isNotSame = @newname <> BINARY oldname;
IF NOT done && @isNotSame THEN
SET @SQL = CONCAT('ALTER TABLE `', tblname, '` CHANGE COLUMN `', oldname, '` `', @newname, '`', datatype);
PREPARE tmpstmt FROM @SQL;
EXECUTE tmpstmt;
DEALLOCATE PREPARE tmpstmt;
END IF;
UNTIL done END REPEAT;
CLOSE cur;
SELECT 'OK' FROM DUAL;
END
The last line
SELECT 'OK' FROM DUAL
will show you if the procedure will end correctly.
Compare the concat function to find your error.
When you have an error in procedure and you can't debug, try to remove lines of code and re execute it to find the offending line/s, or substitute the variable with constant to see if all works as expected.
To find your error I made the procedure return also the result of concat:
SELECT
CONCAT('ALTER TABLE `', tblname, '` CHANGE COLUMN `', oldname, '` `', @newname, '`', datatype)
FROM DUAL
So I found, also, that the statement you dynamically execute was incorrect.
F.