Used as an intensive.
What in sam hill is going on?
What the Sam Hill do you think you're doing?
Who the Sam Hill does he think he is?
Where in Sam Hill is that dog off to?
Origin of sam-hill
One possibility for the origin of this expression is from the Swedish word for "community" which is "samhÃ¤llet". Some Swedish immigrant to the United States might have said, "Nu ver in de samhÃ¤llet has Johnny gone to?!", and it became anglicized, repeated, and immortalized.