Can 3D text be changed via code?

for example if i saved a text prefab saying “forty” could I later on change the prefab to say “fifty” negating the need for multiple prefabs?

Yes, changing the text of a TextMesh during runtime is entirely possible.

Example:

your_prefab.GetComponent<TextMesh>().text = value;

This helped me a lot too, thanks!