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.
I make beef jerky and I have to make the marinade hotter than mortal sin in order for it to be a really hot flavor When it's finished...I use concentrated capsaicin and ground up dried ghost pepper in my hottest variety...but it's still much hotter before it's cooked. By a measure of half. I've been making jerky since 1991.
Depends on how long its cooked and at what heat if you were to put basil or parsley in and then cook it for a long time it will crisp up and blacken and in a sense destroy them. In contrast a roast cooked moderately high and long tied with rosemary all around turns out wonderfully and allows the roast to draw in many of the flavours. In the end it just depends on what spices you are using and how they will be cooked.