Dialkylation of 2-aryl acetonitrile (I) with bromoacetaldehyde dimethyl acetal (II) by means of NaNH2 in toluene provides diacetal (III), which is cyclized to cyanopiperidine derivative (IV) by first hydrolysis of the acetal groups with HCl, followed by reductive amination with methylamine in the presence of NaBH3CN in MeOH. Finally, the target product is obtained by hydrolysis of the nitrile group of (IV) with aqueous H2SO4, followed by esterification performed by heating with EtOH.