Heat a large pot of salted water to a boil over high heat. Prepare a large bowl of ice water.
Add the green beans to the boiling water and cook until nearly tender, about 2 minutes for fresh or 1 minute for frozen. Drain green beans and transfer them to the ice bath for 2 minutes. Drain green beans again, pat them dry and add them to a baking dish.
In a large saucepan over medium-high heat, melt the butter. Whisk in the flour, garlic powder, salt, nutmeg and dijon, and cook for about 2 minutes, whisking occasionally.
Slowly whisk in the stock until smooth. Slowly whisk in the half and half until combined. Bring the mixture to a simmer over medium heat and cook until thickened, stirring occasionally, about 5 minutes.
Pour the sauce over the green beans and toss until fully coated.
Bake on the center rack until the sauce starts to bubble, about 12-15 minutes. Remove from the oven, toss the green beans and sprinkle with fried onions. Continue to bake on the center rack until golden brown, about 5 more minutes.