Proverbs 11:8 in the King James Version
The righteous is delivered out of trouble, and the wicked cometh in his stead.
Context
7 When a wicked man dies, hope perishes, and expectation of power comes to nothing.
8 A righteous person is delivered out of trouble, and the wicked takes his place.
9 With his mouth the godless man destroys his neighbor, but the righteous will be delivered through knowledge.