Cook the Spätzle in plenty of boiling salted water for about 12 minutes. Drain
Heat 4 tablespoons of fat in a saucepan. Sauté the flour in it. Stir in milk, 1/4 l water and stock. Bring to the boil and simmer for about 5 minutes. Stir in processed cheese in flakes. Season sauce with salt, pepper and nutmeg
Peel onions and cut them into rings. Heat 1 tablespoon of fat in a frying pan. Fry the onion rings until golden brown. Take out some onion rings and put aside
Add sauerkraut, cloves, juniper, caraway and bay leaf to the remaining onion rings and braise for about 10 minutes. Season to taste with salt and sugar
Roughly dice the ham. Mix with sauerkraut, spaetzle and sauce. Pour into a greased casserole dish (approx. 30 cm long). Rub Gouda over it. Spread the remaining onion rings on top. Bake in a preheated oven (electric cooker: 200 °C/recirculating air: 175 °C/ gas: level 3) for about 40 minutes. Garnish if necessary