What is the origin of the expression "What in the Sam Hill"?

Student or Learner
What is the origin of the expression "What in the Sam Hill"?
Have you tried googling it? There are a few theories but nobody knows for certain.
I've always assumed it was just a euphemism for What in hell?
But I'm not going to look it up.
It's like an expression my mom grew up with: Cheese and crackers got all muddy.
Last edited by Charlie Bernstein; 26-Oct-2020 at 03:35. Reason: Fix a typo.
I'm not a teacher. I speak American English. I've tutored writing at the University of Southern Maine and have done a good deal of copy editing and writing, occasionally for publication.