Leadership is about having the capacity to make a vision a reality. In the context of transformational leadership, this study examines creative behavior as a key factor in Pakistan’s IT sector. Examining the relationship between transformational leadership and innovative behavior is the main goal of this study. While transformational leadership affects people because it inspires them, fosters morale, and boosts productivity. A moderated mediation model based on social cognitive theory was provided in this study. In contrast, the functions of mediation and moderation were played by knowledge sharing, organizational identification, and learning goal orientation. In this cross-sectional study, we implemented the convenience sample method and gathered 391 valid responses from the IT sector. Using the use of AMOS 26 and SPSS 23, the authors measured the latent variables and discussed their connection using a descriptive and correlational approach. The findings showed that transformational leadership has a favorable and substantial impact on innovative behavior. As a result, the mediation of knowledge exchange unites innovative behavior with transformational leadership. When two moderators’ organizational identification and learning goal orientation are effective, knowledge sharing mediates transformational leadership and innovative behavior. By highlighting the mediating function of knowledge sharing in promoting particular traits of innovative behavior, this research has broadened the scope of social cognition theory.