How long does applesauce last?
From your description, these were clearly sealed as packaged. Assuming that they were a commercial product, they would have been fine on a shelf (assuming local temps didn't cause them to breach the seal).
Anyway, in a refrigerator they are fine. The only problems would be mold (visible, and not going to happen in the fridge) and fermentation (evidenced by bubbles, not going to happen if no outside contaniments since original packaging).
On the other hand, you can core a few apples, heat them in a pot with lemon juice, puree, cool, and have fresh applesauce in an hour. Won't last 2 years, alas.