In-situ preparation of functionalized molecular sieve material and a methodology to remove template