The Apagodu-Zeilberger algorithm can be used for computing annihilating operators for definite sums over hypergeometric terms, or for definite integrals over hyperexponential functions. In this paper, we propose a generalization of this algorithm which is applicable to arbitrary ∂-finite functions. In analogy to the hypergeometric case, we introduce the notion of proper ∂-finite functions. We show that the algorithm always succeeds for these functions, and we give a tight a priori bound for the order of the output operator.