In the space gravitational wave detection mission, inertial sensors play the role of providing an inertial reference for the laser interferometric measurement system. Among them, the capacitance sensor serves as the core key technology of the inertial sensor, used to measure the relative position of the test mass (TM) in the electrode cage. The capacitance sensor utilizes synchronous demodulation technology to extract signals from the AC induction signal. When the phase of the demodulation switch signal is aligned, the synchronous demodulator can most effectively filter out noise, thus directly influencing the performance of the capacitance sensor. However, since the TM is in a suspended state, the information read by the capacitance sensor is dynamic, which increases the difficulty of demodulation phase alignment. In light of this, a method is proposed for achieving the phase alignment of the demodulation switch signal in a dynamic environment. This is accomplished by adjusting the phase of the demodulation switch signal, and subsequently computing the phase difference between the AC induction signal and the demodulation switch signal. At the same time, a measurement and evaluation method for phase deviation is also proposed. Ultimately, an automatic phase alignment system for the demodulation switch signal in dynamic environments is successfully implemented on an FPGA platform, and tests are conducted on a hexapod PI console platform to simulate dynamic environments. The experimental results demonstrate that the system accurately achieves phase alignment in the static environment, with a phase deviation of 0.1394 rad. In the simulated dynamic environment, the phase deviation is 0.1395 rad.