An accurate description of spatial variations in the energy levels of patterned semiconductor substrates on the micron and sub-micron scale as a function of local doping is an important technological challenge for the microelectronics industry. Spatially resolved surface analysis by photoelectron spectromicroscopy can provide an invaluable contribution thanks to the relatively non-destructive, quantitative analysis. We present results on highly doped n and p type patterns on, respectively, p and n type silicon substrates. Using synchrotron radiation and spherical aberration-corrected energy filtering, we have obtained a spectroscopic image series at the Si 2p core level and across the valence band. Local band alignments are extracted, accounting for doping, band bending and surface photovoltage.