A vertical column of light extending upward from the Sun near sunrise or sunset is a sun pillar.
A sun pillar is a member of the atmospheric halo family. It forms when sunlight reflects from numerous flat, hexagonal ice crystals suspended in high clouds or cold air near the ground. The crystals tend to orient themselves nearly horizontally as they fall, acting like tiny mirrors. Reflections from crystals at different heights merge into the appearance of a luminous vertical column.
The pillar is not a solid beam physically extending through the sky. It is an optical effect created by the particular crystals whose reflected light reaches an observer. Plate-shaped crystals generally produce pillars when the Sun is within about 6 degrees of the horizon, which explains why the effect is especially common near sunrise and sunset. Column-shaped crystals can produce one with the Sun as high as about 20 degrees.
A sun pillar may appear above or below the Sun, particularly when the Sun is below the horizon or the observer is at high elevation. Similar light pillars can form around the Moon, streetlights, or other bright sources. A sun dog is a bright side spot, not a vertical column.