Spatially Resolved Control of Ac-Stark Shifts in Cold Atomic Ensemble