Moved column exists check logic