Secondary motor cortex (M2) is a center of motor planning and voluntary movement. Recent studies suggested that the M2 has an important role for sensory-guided motor behaviors, yet the response properties of M2 neurons to the sensory stimulus remain unknown. Here, we used nVistaHD (Inscopix) endoscopy system for in vivo calcium imaging of the excitatory neurons in the M2. We injected adeno-associated virus (AAV), which can express genetically encoded calcium sensor GCaMP6s under the presence of Cre recombinase (AAV9-Flex-GCaMP6s), into the M2 of CaMKIIα-Cre transgenic mice. Mice were head-fixed but freely moving on the treadmill. We found that ~20% of excitatory neurons in the secondary motor cortex show the auditory response but rarely the visual response. Interestingly, this auditory response in M2 neurons disappeared when mice are in the moving state before the onset of the stimuli. These findings suggest that M2 neurons play a critical role in gating sensory information to motor behaviors depending on the behavioral states of the animal.