Preheat oven to 375°. In a large saucepan, heat butter over medium-high heat. Add onion; cook and stir until tender. Stir in flour and seasonings until blended; gradually whisk in milk. Bring to a boil, stirring constantly; cook and stir 2 minutes or until thickened. Stir in soup. Remove from heat; stir in sour cream.
In a greased 13x9-in. baking dish, layer half of each of the following: potatoes, ham, cheese and sauce. Repeat layers.
Bake, covered, 30 minutes. Bake, uncovered, 40-50 minutes longer or until potatoes are tender.
