I would have to research to come up with specific references, but here is generally what I know. I have seen a reference to a "stencil box" on a drawing of a Soo Line caboose. It was in the center of the cupola, and displayed to the front and rear through the center windows of the cupola.
I know I have seen other references as well, including the explanation that it was used to provide an illuminated display of train numbers for lineside operators. A lantern light was shined through a cut out stencil that defined the numerals to display. I assume that they had all the letters and numbers defined on separte stencils that could be set in the box like type setting. I think I recall learning that the stencils were cut out of sheet metal.
Generally, I conclude that the practice was common circa 1900. How late or early it was used, I do not know. But I get the general impression that it ended circa 1910-1920. I have no idea how common the practice was, but I have seen the term, "stencil box" used in more than one reference.
I assume that it was part of a general practice of displaying train numbers from the caboose. Maybe somebody can find references to that practice in old rule books. The stencil box was just a means of displaying the number at night.
I have a photo of an M&StL caboose hop circa 1895, and it shows a large number displayed in the center window of the caboose cupola. This is a daytime photo.
I will see what information I can dig up in my books. There might be something in
The American Railroad Freight Car by John White.