You know how real-world religions have all sorts of heresies and schisms that would make great fodder for world-building in D&D, except the way gods work kinda makes it not work?
The perceived issue is that a heretical cleric would simply lose their spellcasting, making it obvious they were wrong. And you certainly couldn't have a Good religion give rise to an Evil inquisition, right?
One solution is to take the Eberron approach where the existence of the gods is not a certainty, and all clerics might just be drawing their actual power from space rocks. But did you know there's actually an old rule in the game that you can use to mitigate this issue without changing the fundamental way deities function? Don't worry, this is one that ports super easy into any edition of the game, though you'll have to adjust things a bit for 4th.
Your deity only grants you 6th and 7th level spells. And, umm, I guess 8th and 9th level ones in editions that have those. 3rd-5th level spells come from the deity's servitors, who might have their own ideas about their superior's agenda. 1st-2nd level spells? Those you get just from knowing the proper religious rites, and the spells just sort of coalesce from the ambient divinity particles or something.
So there you have it, even a truly heretical priest still has divine miracles they can perform to grow their heretical flock. You might not be raising the dead, but charming snakes ain't nothing to sneeze at.