And if you want to avoid a UNION - not certain of performance here, but this might be better (see fiddle here) - you don't have to query the table twice as for @Akina's query! You might want to check with a large dataset.
Create and populate table:
CREATE table pat_dis
INSERT INTO pat_dis VALUES
( 1, 2, 1.1),
( 1, 5, ...
This below worked for me:
WHERE table_schema = 'mydatabase'
and COLUMN_NAME = 'mycolumn'
AND table_name = 'mytable' LIMIT 1;
set @query = IF(@exist <= 0, 'ALTER TABLE mydatabase.`mytable` ADD COLUMN `mycolumn` MEDIUMTEXT NULL',
'select \'Column Exists\' status');...