In this paper, we investigate the Moreau envelope of the supremum of a family of convex, proper, and lower semicontinuous functions. Under mild assumptions, we prove that the Moreau envelope of a supremum is the supremum of Moreau envelopes, which allows us to approximate possibly nonsmooth supremum functions by smooth functions that are also the suprema of functions. Consequently, we propose and study approximated optimization problems from infinite and stochastic programming for which we obtain zero-duality results and optimality conditions without the verification of constraint qualification conditions.