Below, are several approaches that you can use in this case:
1. Use wildcards inside the target grid name. For instance, if your grid may have the following names: Grid1, Grid2, and so on, you can use the following mask for the window name - Grid*.
For more information, please refer to the Using Wildcards help topic.
2. Use the Find method to find the target window not by this name, but by the values of its properties.
3. Use wildcards in your name mapping scheme to map the window with the dynamic name. For more information, please refer to the Using Wildcards in Name Mapping help topic.