To cook the endive, combine the butter, sugar, salt, and 10 1/2 cups water in a large pot. Bring to a boil, then reduce the heat to maintain a steady simmer. Add the endive, cover, and cook until very tender, about 45 minutes. A knife should be able to pierce through with no resistance. Use a slotted spoon to transfer the endive to paper towels. Reserve 1 1/4 cups cooking liquid. When cool enough to handle, squeeze out as much liquid as possible from the endive.
Wrap each endive with slices of ham. Arrange the endive in a shallow baking dish that holds them snugly; you don't want any space between the endive.
Preheat the oven to 400°F.
To make the béchamel, melt the butter in a medium saucepan over medium-low heat until golden. Add the flour and cook, whisking constantly, until the mixture smells nutty, about 2 minutes. Continue whisking and add the milk, then the reserved endive cooking liquid in a slow, steady stream. Bring the mixture to a boil while whisking. Continue whisking until thickened, about 5 minutes. Whisk in the nutmeg and pepper.
Pour the béchamel over the endive and spread to cover them evenly. Sprinkle the cheese evenly over the top. Set the dish on a rimmed baking sheet and bake until bubbly and golden brown on top, about 15 minutes. If you want the top more browned and crusty, broil for a minute or two after baking. Serve hot.