In this paper, we provide an approximation method for probability function and its derivatives, which allows using the first order numerical algorithms in stochastic optimization problems with objectives of that type. The approximation is based on the replacement of the indicator function with a smooth differentiable approximation – the sigmoid function. We prove the convergence of the approximation to the original function and the convergence of their derivatives to the derivatives of the original ones. This approximation method is highly universal and can be applied in other problems besides stochastic optimization – the approximation of the kernel of the probability measure, considered in the present article as an example, and the confidence absorbing set approximations.