Someone asked me, “Do you really think you can change God’s mind with prayer?” What do you think?
God does not change his mind in response to our prayers or our actions. Though Scripture sometimes speaks as if he does, this language is figurative, not literal. If he did change his mind, that would mean that God had imperfect knowledge.
However, the fact that God does not change his mind does not mean that we should refrain from praying. God, in his perfect wisdom, has made some things we need contingent on our praying for them. He does this so that we may turn our hearts to him, rely on him, trust in him, and grow in the virtues of faith, hope, and charity.