Background: The Dynamic Modified Stochastic p-Median Problem (DMS-p-MP) is an important problem in supply chain network design, as it deals with the optimal location of facilities and the allocation of demand in a dynamic and uncertain environment. Methods: In this research paper, we propose a mixed-integer linear formulation for the DMS-p-MP, which captures the key features of the problem and allows for efficient solution methods. The DMS-p-MP adds two key features to the classical problem: (1) it considers the dynamic nature of the problem, where the demand is uncertain and changes over time, and (2) it allows for the modification of the facility locations over time, subject to a fixed number of modifications. The proposed model uses robust optimization in order to address the uncertainty of demand by allowing for the optimization of solutions that are not overly sensitive to small changes in the data or parameters. To manage the computational challenges presented by large-scale DMS-p-MP networks, a Lagrangian relaxation (LR) algorithm is employed. Results: Our computational study in a real-life case study demonstrates the effectiveness of the proposed formulation in solving the DMS p-Median Problem. The results show that the number of opened and closed buildings remains unchanged as the time horizon increases due to the periodic nature of our demand. Conclusions: This formulation can be applied to real-world problems, providing decision-makers with an effective tool to optimize their supply chain network design in a dynamic and uncertain environment.