Real seismic data consist of multiple traces captured by an array of receivers. These multiple traces are sorted by the common midpoint between the source and the receiver, and the time-lag between different traces is corrected by a normal move-out correction process. After these preprocessing steps, the sorted traces contain the same information about the earth sublayers and are corrupted by noise. The next step, termed stacking in seismic signal processing, involves the construction of an optimum trace with an improved signal-to-noise ratio (SNR) from these sorted traces. In this letter, we present an improved method for weighted stacking, where each trace is weighed in accordance with the noise variance. Using the first-order derivative property of Ramanujan sums, we perform the estimation of noise variance in each trace. Numerical results demonstrate that the method presented in this letter has better SNR for the trace obtained after stacking in comparison with existing methods.