<?php
$res = run_query('SHOW COLUMNS FROM ' . $config['table_prefix'] . 'calc_template LIKE "calc_num"');
if (!sql_num_rows($res)) {
    run_query('ALTER TABLE ' . $config['table_prefix'] . 'calc_template ADD `calc_num` int(11) NOT NULL DEFAULT 0');
}