I heard that putting spices in something and putting it in the oven will eliminate the taste of the spices. Is this true? For example if I were to put spice in lasagna before putting it in the oven you will not be able to taste the spice afterwards.
It is not true that baking destroys spices (for most spices I know; unless you put them to bake dry on top of something, which might burn them).
I made this answer a bit broader as we add flavor to food not only with spices but with herbs or flavorful vegetables, mushrooms, and fruits as well.
Baking/heat will likely change the texture and flavor of spices, vegetables, and especially fresh herbs, but it will not destroy them. Sometimes it will take away the fresh sharpness (like in garlic or onion).
Sometimes frying or roasting spices before cooking is even desired to give them a slight toasty flavor (like whole cumin and other spices in Indian cuisine). Some say that "only with roasting all flavors can be unlocked".
So it depends on what effect you want to achieve with a spice/seasoning.
And in your case putting spices into lasagna before baking will help blend the flavors together. However, putting some fresh herbs on top of the lasagna before serving will give the dish some color and freshness.
The flavors of most spices are quite stable, and will not be destroyed by cooking from any method, including baking. You will see that traditional recipes often add spices at the beginning of a recipe, especially for robust hard spices like cinnamon, anise, caraway, cumin, allspice, dried chili powder, and so on.
In fact, in many cuisines, the spices are bloomed by frying or toasting as part of assembling the dish in order to bring out their aromas and flavors.
This idea may have originated with herbs (especially the more delicate ones like basil, tarragon, or cilantro) whose flavors are more volatile or heat sensitive, and so are traditionally added in the last few minutes of cooking, or even after the cooking.
Even so, with herbs, this is not universal as some of the more hardy ones do stand up to cooking, such as oregano, sage, and similar.