title: Rename column for all tables in mysql database
body: <p>I need to rename column for all tables in my databse.
  I could get list of columns using this query:</p>
  
  <pre><code> SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME= &lt;Column Name&gt;;
  </code></pre>
  
  <p>But how actually I could rename it as simple as possible and do not write </p>
  
  <pre><code>ALTER TABLE &lt;Table Name &gt;RENAME COLUMN &lt;Old name&gt; to &lt;New Name&gt;;
  </code></pre>
  
  <p>for each table. </p>
  
  <p>I've tried to write a procedure:</p>
  
  <pre><code>DELIMITER $$
       DROP PROCEDURE IF EXISTS  renameColumn $$
       CREATE PROCEDURE renameColumn(IN oldName tinytext, IN newName tinytext)
       BEGIN
         DECLARE @name VARCHAR(255);
         DECLARE exit_loop BOOLEAN;         
         DECLARE tableName_cursor CURSOR FOR SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME=oldName;
         DECLARE CONTINUE HANDLER FOR NOT FOUND SET exit_loop = TRUE;
         OPEN tableName_cursor;
         rename_loop: LOOP
          FETCH  tableName_cursor @name;
          ALTER TABLE @name RENAME COLUMN oldName to newName;
           IF exit_loop THEN
               LEAVE rename_loop;
           END IF;
         END LOOP rename_loop;
       END $$
       DELIMITER;
  </code></pre>
  
  <p>But I have the following error:
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@name VARCHAR(255);</p>
  
  <p>DECLARE exit_loop BOOLEAN;         </p>
  
  <p>DECLARE ta' at line 3</p>
  
  <p>Could you please help me to resolve this issue</p>