Gather all ingredients. Preheat the oven to 350 degrees F (175 degrees C). Grease an 11x7-inch baking dish.
Bring a large pot of salted water to a boil. Cook potatoes in boiling water until tender but firm, about 15 minutes. Drain and cool.
Combine potatoes, ham, corn, and parsley in a large bowl; set aside.
Heat butter in a large saucepan over medium-high heat. Sauté onions in hot butter for 2 minutes, then stir in flour until blended. Pour in milk slowly, stirring constantly; season with pepper. Bring to a boil. Cook and stir for 2 minutes.
Pour over ham mixture; stir until combined. Pour into the prepared baking dish.
Bake, covered, in the preheated oven for 25 minutes. Uncover the dish and sprinkle with cheese. Continue baking until cheese is melted, 5 to 10 minutes more.
Enjoy!
Notes
Add a cup of frozen peas or mixed vegetables if your family likes them.