Matthew 7:21-23:

Not every one that saith unto me, Lord, Lord, shall enter into the kingdom of heaven; but he that doeth the will of my Father which is in heaven.
Many will say to me in that day, Lord, Lord, have we not prophesied in thy name? and in thy name have cast out devils? and in thy name done many wonderful works?
And then will I profess unto them, I never knew you: depart from me, ye that work iniquity.

Notes on Matthew 7:21-23:

This shows the power invested in the name of Jesus – unbelievers could use it with results!  In fact, even the disciples weren’t born again and they rejoiced that the demons were subject to them in Jesus’ name (Luke 10:17).

This passage might rattle people because they might conclude that entry to the kingdom of heaven depends on doing good works instead of knowing Jesus.  But that can’t be true.  “Doing the will of the Father” now is receiving Jesus.  The people who were commanded to depart were NOT people who never did any good works.  In fact, they cited their many wonderful works!  But the problem will be that they never knew Him.  No one goes to hell for a lack of good works; hell awaits only those who do not know Jesus – who never receive Him as Lord.  You can’t earn your way to heaven with many wonderful works; you can only receive Jesus and get entry to heaven that has nothing to do with your works.

See also:

Notes on Ephesians 5:5-7
What Faith Is
The Power in the Name of Jesus
Healing Is Not a Formula
If You Blow It
Healing and the Holy Spirit
How Much Faith Does It Take to Heal a Serious Illness?
Why Does God Keep Using a Certain Healing Minister So Mightily When His Personal Life Is So Messed Up?
Objection: Jesus Said That Those Who Came After Him and Did Miracles Would Be Unsaved Deceivers (Matthew 7:22-23)
Objection: If Everyone Could Perform Miracles, Paul’s Signs of an Apostle Would Be Meaningless – He’d Be Just Like Everyone Else
Objection: Healing and Miracles Are Not for This Current Dispensation