Sort columns by creation order or alphabetically

(cherry picked from commit d8cc22debdd25ab4955418f59c3fd2bff7d67017)