SET @dbname = DATABASE();
SET @tablename = 'redemption_code';
SET @colname = 'status';
SET @sql = (
    SELECT IF(
        COUNT(*) > 0,
        'ALTER TABLE `redemption_code` DROP COLUMN `status`;',
        'SELECT "Column `status` does not exist";'
    )
    FROM information_schema.COLUMNS
    WHERE TABLE_SCHEMA = @dbname
      AND TABLE_NAME = @tablename
      AND COLUMN_NAME = @colname
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
