How to find if Table/View is used in Stored Procedure in SQL Server

In this post, we are going to learn how to find out if the table is used in a Stored Procedure. we have multiple ways to do that.

This System Stored Procedure will return you list of table/views used by the Stored procedure/View. You can pass the view name or Stored Procedure as parameter,it will return you tables/views which are used in the object.

One disadvantage of using sp_depends is , it will not show you tables/views which are not in current database. If you have used objects from other databases, this information might be misleading.

--By using sp_depends, You can provide Stored Procedure Name or View name as parameter
EXEC sp_depends '[dbo].[GetCustomer]'

The 2nd method is to use the sys.sysdepends view with combination of sys.sysobjects to get the information. This also works the same way. It will not show you cross database objects ( Tables,Views) if have used in Stored Procedure or view definition.

--Get Information from sys.sysdepends 
SELECT DISTINCT OBJECT_NAME( AS StoredProcedureNameName, AS TableOrViewName
 FROM sys.sysdepends SDINNER JOIN sys.sysobjects O 
 INNER JOIN sys.sysobjects OB 
AND O.xtype='P'

3rd method is to use the sys.all_sql_modules system view. The definition column of this view has definition of Stored Procedure, Views, Functions etc.You can write query as given below to check if any of the Stored Procedure or object is using the table/view you are looking for.

--Use sys.all_sql_modules system view to get information if table is used
--in a Stored Procedure
 FROM sys.all_sql_modules 
WHERE definition LIKE '%vw_Employee%'


  1. Sales reps consistently attempt to settle on you settle on a choice to purchase now, and will attempt to convince you to settle on an immediate arrangement.Used Cars

  2. This data and some other required data will be provided in the car fix manual. Car Tire Repair Shop

  3. Thank for this blog more informative step by step and useful content. I here by attached my site would see this blog

    7 tips to start a career in digital marketing

    “Digital marketing is the marketing of product or service using digital technologies, mainly on the Internet, but also including mobile phones, display advertising, and any other digital medium”. This is the definition that you would get when you search for the term “Digital marketing” in google. Let’s give out a simpler explanation by saying, “the form of marketing, using the internet and technologies like phones, computer etc”.

    we have offered to the advanced syllabus course digital marketing for available join now

    more details click the link now

  4. Amazing blog very nice

    Web designing trends in 2020

    When we look into the trends, everything which is ruling today’s world was once a start up and slowly begun getting into. But Now they have literally transformed our lives on a tremendous note. To name a few, Facebook, Whats App, Twitter can be a promising proof for such a transformation and have a true impact on the digital world.

    we have offered to the advanced syllabus web design and development for available join now

    more details click the link

  5. Este é um ótimo recurso que você está fornecendo e distribuindo gratuitamente. Adoro ver blogs que entendem o valor de fornecer um recurso de qualidade gratuitamente. ver mensagens enviadas do telemovel

  6. Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. 웹툰보기

  7. FreeAssignmentHelp is the World’s Best Online Assignment help, Academic Homework Help and writing assistance web provider that prides itself in being the best online assignment help website for students around the world.
    Get Connected With Our 450+ Academic Experts To Receive Custom Assignment Solutions Along With Plagiarism Reports For ScorinG good Marks, Not only this, even if you do not require a typically Do My Assignment For Me kind of service and simply need expert consultation and writing help on assignment writing styles, assignment writing services
    Management Accounting Assignment Help Uk

    Financial Accounting Assignment Help Uk

    Accounting Lease Critical Review Assignment Help Uk

    Database Design Concept Assignment Help Uk

    Forensic Accounting Bernard Assignment Help

  8. Software engineering Assignment help concerns methods and techniques to develop large software systems. The engineering metaphor is used to emphasize a systematic approach to develop systems that satisfy organizational requirements and constraints. This chapter gives a brief overview of the field and points at emerging trends that influence the way software is developed.
    Get Connected With Our 450+ Academic Experts To Receive Custom Assignment Solutions Along With Plagiarism Reports For ScorinG good Marks, Not only this, even if you do not require a typically Do My Assignment For Me kind of service and simply need expert consultation and writing help on assignment writing styles, assignment writing guides and need free study notes to consult for your essay research writing on hundreds of topics, including Economics Statistics, Business, Management, Finance, Accounts, History,

  9. When you are making travel plans make a list of all the things you need in your rental car and all of your preferences so that you can be sure the car rental agency you choose has what you want. With a little advance planning you can get exactly the car you need to have a great time on your vacation. Luxury Car Rental Miami

  10. Thanks for sharing the information about Content writing services it helped me lot to write.

  11. So it is intriguing and great composed and see what they think about other individuals. Body building Product Review

  12. Excellent information with unique content and it is very useful to know about the information based on blogs.

    Luxury Car Rentals

  13. This comment has been removed by the author.

  14. Delivering high-quality assignments on schedule is our top goal since at MyAssignmentExperts, we cherish what our customers think of our online assignment help service.

    My Assignment Expert

  15. Our experts at Accounting assignment Help and Coursework writing help Malaysia
    work around the clock to create the best assignments possible for every student.

    My Assignment Experts

  16. Homework Help gives you the solution you need with just a click as well as the help of highly experienced and knowledgeable teachers online. You can be confident regarding the quality of the assistance. There is no need to move between classes and physical classes, every topic assistance is in one place.
    My Assignment help

  17. The historical backdrop of SaaS arrangements goes back around 50 years when the time sharing of registering assets were presented through imbecilic terminals during the 1960s. The trailblazer of the antecedent of SaaS administration was IBM who begun offering the registering assets through its structure PCs. During the 1980s and 1990s, the application specialist co-ops (ASP) model of business arose. The fundamental supplier of ASP administration included FutureLink Partnership and USI Inc. The term 'SaaS' was begat in a specialized article inside distributed in Programming Data Industry Affiliation (SIIA) distributing in 2000. The current type of SaaS arrangements completely made due, multitenant, and midway facilitated appeared by 2012>> hire saas dev

  18. Thank you for spreading the word about the blog.
    Continue to share things like this blog.
    You have provided very good information in this blog to all of us. Please continue to share blogs like this one.

    Sociology Dissertation Help

  19. СRM is a very useful function that makes advantages, for example, inflexibity. With this flexibility, businesses can create a CRM solution that meets their unique needs and helps them to achieve their specific goals. Based on this, it is quite normal to be interested in the microsoft dynamics crm costs

  20. I just want to know for SQL servers then my friend shares a link of this post with me. I got all the important information about this from this post. They also explain about what are sentence patterns in their post. When I clicked on their given link. I saw a tool that helps for improving our mistakes in grammar.

  21. Your post is clear and easy to follow. I appreciate that you've included screenshots to illustrate each process step. This makes it much easier for us to understand what to do to find if TableView is being used in a Stored Procedure. Dissertation Help Online UK

  22. Ensuring quality control is a challenge that firms may experience while employing outsourcing for the first time. It can be difficult to guarantee that the job fulfills the necessary standards when there is no direct control over the outsourced labor. It's crucial to establish precise quality control methods, carry out routine quality checks, and establish a procedure for handling any difficulties that may arise in order to address this problem. On this site you can deeply learn How Online Image Annotation Services Work and a lot more useful info!

  23. This site expertly captures the core of its subject, offering excellent content that is both educational and interesting. an exceptional online resource. Excellently advised!

    Best travel guide to Punta Cana

  24. Your blog site is very informative and learnable site . Thank you so much for sharing this post with us . custom erp development

  25. This blog is very informative blog to give good knowledge shared to all. keep sharing like this information. In this blog we found very interesting things that could we use to exploit it.
    Here are something for you all.
    Perico Ripico Tours: Embark on an unforgettable adventure with breathtaking landscapes, expert guides, and unmatched hospitality. Immerse yourself in nature's wonders and create lifelong memories. A journey like no other!
    Best travel guide to Punta Cana

  26. In such scenarios, people tend to use these words interchangeably without knowing that each has a different meaning attached to it. Among these words are Brand, Branding, and Brand Identity, which many consider as synonyms. However, Brand Branding

  27. Nmims Assignment

    Buy NMIMS assignment Sep 2023. Get 100% plagiarism free NMIMS solved assignments sep 2023 with high quality content from us at cheap price. We provide best nmims assignment writing service in India.

    Nmims Solved Assignment